<%@ page language="java" import="java.util.*,News.dao.*,News.entity.*"
	pageEncoding="utf-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<title>新闻发布系统管理后台</title>
<link href="css/admin.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function check() {
		var ntitle = document.getElementById("ntitle");
		var nauthor = document.getElementById("nauthor");
		var nsummary = document.getElementById("nsummary");
		var ncontent = document.getElementById("ncontent");

		if (ntitle.value == "") {
			alert("标题不能为空！！");
			ntitle.focus();
			return false;
		} else if (nauthor.value == "") {
			alert("作者不能为空！！");
			nauthor.focus();
			return false;
		} else if (nsummary.value == "") {
			alert("摘要不能为空！！");
			nsummary.focus();
			return false;
		} else if (ncontent.value == "") {
			alert("内容不能为空！！");
			ncontent.focus();
			return false;
		}
		return true;
	}

	function clickdel() {
		return confirm("确认删除吗？");
	}
</script>
</head>
<body>
	<div id="header">
		<div id="welcome">欢迎使用新闻管理系统！</div>
		<div id="nav">
			<div id="logo">
				<img src="images/logo.jpg" alt="新闻中国" />
			</div>
			<div id="a_b01">
				<img src="images/a_b01.gif" alt="" />
			</div>
		</div>
	</div>
	<div id="admin_bar">
		<div id="status">
			管理员：admin 登录 &#160;&#160;&#160;&#160; <a href="dologinout.jsp">login
				out</a>
		</div>
		<div id="channel"></div>
	</div>



	<div id="main">
		<div id="opt_list">
			<ul>
				<li><a href="addnews.jsp">添加新闻</a></li>
				<li><a href="modifynews.jsp">编辑新闻</a></li>
				<li><a href="addTopic.jsp">添加主题</a></li>
				<li><a href="modifytopic.jsp">编辑主题</a></li>
			</ul>
		</div>

		<div id="opt_area">
			<h1 id="opt_type">编辑新闻：</h1>



			<div class="content">
				<ul class="class_date">
					<li id='class_month'></li>
				</ul>
				<ul class="classlist">
					<%
						int pageNo = 1;
						try {
							pageNo = Integer.parseInt(request.getParameter("pageNo"));
						} catch (Exception e) {
						}
						Page<News> p = null;
						List<News> nlist = null;
						Newsdaos nd1 = new Newsdaos();
						p = nd1.query(pageNo);
						nlist = p.getDatas();
						for (int i = 0; i < nlist.size(); i++) {
					%>
					<li><a href='News.jsp?nid=<%=nlist.get(i).getNid()%>'><%=nlist.get(i).getNtitle()%></a>
						<span> 作者：<%=nlist.get(i).getNauthor()%>&#160;&#160;&#160;&#160;<a
							href='modifynewspage.jsp?nid=<%=nlist.get(i).getNid()%>'>修改</a>&#160;&#160;&#160;&#160;
							<a href='Delnews.jsp?nid=<%=nlist.get(i).getNid()%>'
							onclick='return clickdel()'>删除</a></span></li>
					<%
						if ((i + 1) % 5 == 0) {
								out.print("<li class='space'></li>");
							}
						}
						out.print("<p align='right'>");
						if (p.getPageNo() > 1) {
							out.print("<a href='modifynews.jsp?pageNo=" + (p.getPageNo() - 1) + "'>上一页</a>");
						}
						out.print("当前页数:[" + p.getPageNo() + "/" + p.getTotalPages() + "]");
						if (p.getPageNo() < p.getTotalPages()) {
							out.print("<a href='modifynews.jsp?pageNo=" + (p.getPageNo() + 1) + "'>下一页</a>");
						}
						out.print("</p>");
					%>
				</ul>
			</div>
		</div>
	</div>
	<div id="site_link">
		<a href="#">关于我们</a><span>|</span> <a href="#">Aboue Us</a><span>|</span>
		<a href="#">联系我们</a><span>|</span> <a href="#">广告服务</a><span>|</span>
		<a href="#">供稿服务</a><span>|</span> <a href="#">法律声明</a><span>|</span>
		<a href="#">招聘信息</a><span>|</span> <a href="#">网站地图</a><span>|</span>
		<a href="#">留言反馈</a>
	</div>
	<div id="footer">
		<p class="">
			24小时客户服务热线：010-68988888 &#160;&#160;&#160;&#160; <a href="#">常见问题解答</a>
			&#160;&#160;&#160;&#160; 新闻热线：010-627488888<br />
			文明办网文明上网举报电话：010-627488888 &#160;&#160;&#160;&#160; 举报邮箱：<a href="#">jubao@jb-aptech.com.cn</a>
		</p>
		<p class="copyright">
			Copyright &copy; 1999-2009 News China gov, All Right Reserver<br />
			新闻中国 版权所有
		</p>
	</div>
</body>
</html>